#ifndef __BSP_DAC_H
#define __BSP_DAC_H

#include "./SYSTEM/SYS/sys.h"

extern DAC_HandleTypeDef g_dac_dma_handle;          /* DAC（DMA输出）句柄 */
extern uint16_t g_dac_sin_buf[4096];                /* 发送数据缓冲区 */

void dac_init(uint8_t outx);                        /* DAC通道1初始化 */ 
void dac_set_voltage(uint8_t outx, uint16_t vol);   /* 设置通道1/2输出电压 */

void dac_triangular_wave(uint16_t maxval, uint16_t dt, uint16_t samples, uint16_t n);   /* 输出三角波 */

void dac_creat_sin_buf(uint16_t maxval, uint16_t samples);                              /* 产生正弦波函序列 */
void dac_dma_wave_init(uint8_t outx, uint32_t par, uint32_t mar);                       /* DAC DMA输出波形初始化函数 */
void dac_dma_wave_enable(uint16_t cndtr, uint16_t arr, uint16_t psc);                   /* DAC DMA输出波形使能 */

#endif
